<template>
    <div>

        <el-dialog
                title="修改"
                :visible.sync="dialogVisible"
                width="30%"
        ><el-form :label-position="labelPosition" :model="xtcs" ref="xtcs" :rules="rules" label-width="120px"  :inline="true"  class="demo-form-inline">
            <el-form-item label="参数标识:"  prop="csbs" class="sbj">
                <el-input v-model="xtcs.csbs"  placeholder="请输入参数标识"></el-input>
            </el-form-item>
            <el-form-item label="参数值:"  prop="csz" class="sbj">
                <el-input v-model="xtcs.csz"  placeholder="请输入参数值"></el-input>
            </el-form-item>
            <el-form-item label="参数标识说明:"  prop="csbssm" class="sbj">
                <el-input type="textarea" v-model="xtcs.csbssm"  placeholder="参数标识说明"></el-input>
            </el-form-item>
            <el-form-item label="备注:" class="sbj">
                <el-input type="textarea" v-model="xtcs.bz"  placeholder="备注"></el-input>
            </el-form-item>
        </el-form>
            <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="update">确 定</el-button>
          </span>
        </el-dialog>

    </div>
</template>

<script>
    import {jcggXtcsUpdate} from '@/api/app/xtgl0301/xtcs.js'
    export default {
        data(){
            return{
                labelPosition: 'right',
                dialogVisible:false,                                //定义弹框隐藏
                xtcs:{
                    csbs:'',
                    csbssm:'',
                    bz:'',
                    csz: '',
                },
                rules:{
                    csbs:[
                        { required: true, //是否必填
                            message: '参数标识不能为空', //规则
                            trigger: 'blur'  //何事件触发
                        }
                    ],
                    csz:[
                        { required: true, //是否必填
                            message: '参数值不能为空', //规则
                            trigger: 'blur'  //何事件触发
                        }
                    ],
                    csbssm:[
                        { required: true, //是否必填
                            message: '参数标识说明不能为空', //规则
                            trigger: 'blur'  //何事件触发
                        }
                    ]
                }
            }
        },
        methods:{
            async update(){
                let parms ={
                    csbs:this.xtcs.csbs,
                    csbssm:this.xtcs.csbssm,
                    bz:this.xtcs.bz,
                    csz:this.xtcs.csz,
                }
                let data = await jcggXtcsUpdate(parms)
                this.$emit('jcggXtcsFindListByPage')                 //为父类自定义标签引用，刷新列表数据
                this.hidden()
            },

            show(){
                this.dialogVisible = true
                this.$nextTick(() => {                         //清除弹框验证
                    this.$refs['xtcs'].clearValidate()
                })
            },
            hidden(){
                this.dialogVisible = false
            },
        },
    }
</script>

<style scoped>
    @import "../../../../styles/app0301.scss";
    .sbj {
        margin-top: 15px;
    }

    .el-input,.el-select {
        width:100%!important;
    }
</style>